package dk.eclipse.android.badassapp.helper;

import android.content.Context;
import android.os.Vibrator;

/**
 * This helper handles vibration.
 * 
 * @author Ronni
 *
 */
public class VibratorHelper {

	/**
	 * Vibrates for a number of milliseconds.
	 * 
	 * @param context
	 * @param milliseconds
	 */
	public static void vibrate(Context context, long milliseconds) {
		((Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE))
				.vibrate(milliseconds);
	}

	/**
	 * Vibrates a given interval and repeats it if needed.
	 * 
	 * @param context
	 * @param pattern
	 * @param repeat
	 */
	public static void vibrate(Context context, long[] pattern, int repeat) {
		((Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE))
				.vibrate(pattern, repeat);
	}

	/**
	 * Vibrates a given interval.
	 * 
	 * @param context
	 * @param pattern
	 */
	public static void vibrate(Context context, long[] pattern) {
		((Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE))
				.vibrate(pattern, -1);
	}

}
